function checkme() {
	var offset_left = $("div.title_header").offset().left + 40;
	var offset_top = $("div.title_header").offset().top;

	var offset_center_top = $("div.center").offset().top;
	var offset_center_left = $("div.center").offset().left;

	var diff_center = ($("div.center").width() / 2) - ($(".logotype").width() / 2);
	offset_center_left += diff_center;
	var diff_center_height = $("div.center").height() / 4;
	offset_center_top += diff_center_height;
	$(".logotype").css({
		"top" : offset_center_top + 'px',
		"left" : offset_center_left + 'px' 
	});
	
	$(".logotype").show();
	
	$("#header").hide();
	$("#footer").hide();
	$("#header").css("background","url(/img/header-bg.png) center center no-repeat transparent");
		$(".buttons a").click(function(){
			var clicked = $(this);
			$("#wrapper").css("background","#10091c");
			
			if(clicked.attr('id') == 'b_ru') {
				$(".button_en img").css('height','15px');
				$(".button_en img").css('width','21px');
				$(".button_en img").css('opacity','0.5');
	            $.post("/changelang",{"lang":"ru"});
			} else {
				$(".button_ru img").css('height','15px');
				$(".button_ru img").css('width','21px');
				$(".button_ru img").css('opacity','0.5');
	            $.post("/changelang",{"lang":"en"});
			}
			$(".center").fadeOut();
			$("#header").fadeIn(2000);
			$(".right_header").fadeIn(2000);
			$(".title_header p").fadeIn(2000);
			$("#footer").fadeIn(2000);
	
			$(".logotype").stop().animate({
				"top": offset_top,
				"left": offset_left
			}, 2000);
			$(".logotype img").stop().animate(
					{
						'height' : '61px',
						'width' : '99px'
					}, 2000, function(){
						if(clicked.attr('id') == 'b_ru') {
							location.href = "/ru";
						} else {
							location.href = "/en";
						}
			});
		});
}
$(document).ready(function(){window.onload = checkme;});